package com.longyiqun.cm.controller.module;

import com.alibaba.fastjson.JSON;
import com.longyiqun.cm.PageUtil;
import com.longyiqun.cm.TablePage;
import com.longyiqun.cm.service.CasesService;
import com.longyiqun.cm.service.ModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * program: CaseManager
 * package: com.longyiqun.cm.controller.module
 * author: 龙轶群
 * create: 2018-04-13 19:29
 **/

@RestController
@RequestMapping("/api/module")
public class ModuleRestControllerImpl {

    @Autowired
    ModuleService moduleService;

    @Autowired
    PageUtil pageUtil;

    @RequestMapping("/getModuleForPaging")
    public String  getCaseForPaging(@RequestParam int pageNumber, @RequestParam int pageSize) {
        TablePage tp= pageUtil.getDataForPaging(moduleService.getModuleForPaging(pageNumber, pageSize));
        return JSON.toJSONString (tp);
    }
    @RequestMapping("/getPlatFromServer")
    public String  getPlatFromServer(@RequestParam int pageNumber, @RequestParam int pageSize) {
        TablePage tp= pageUtil.getDataForPaging(moduleService.getPlatFormForPaging(pageNumber, pageSize));
        return JSON.toJSONString (tp);
    }
    @RequestMapping("/getLeaderFromServer")
    public String  getLeaderFromServer(@RequestParam int pageNumber, @RequestParam int pageSize) {
        TablePage tp= pageUtil.getDataForPaging(moduleService.getLeaderFormForPaging(pageNumber, pageSize));
        return JSON.toJSONString (tp);
    }
    @RequestMapping("/getServerFromServer")
    public String  getServerFromServer(@RequestParam int pageNumber, @RequestParam int pageSize) {
        TablePage tp= pageUtil.getDataForPaging(moduleService.getServerFormForPaging(pageNumber, pageSize));
        return JSON.toJSONString (tp);
    }
}
